/* 
 * Project: colobok
 * and open the template in the editor.
 * @author: Sviatoslav Mysachenko <svyatoslavik@gmail.com>
 */
var MainMap = function(options){
    var map;

    options = $.extend({
        mapCanvas: $('#mainmap').get(0)
    },options);
    function init(){
        initMap();
        registerComponent();
    }
    function initMap(){
        map = new google.maps.Map(options.mapCanvas, {
          center: new google.maps.LatLng(49.34, 30.54),
          zoom: 6,
          mapTypeId: google.maps.MapTypeId.ROADMAP
        });

        map.bindOneEvent('idle', function(){
            var mapDataLoader = new TileDataLoader();
            mapDataLoader.setMap(map);
            $.loader = mapDataLoader;
        });

    
//        var panoramioLayer = new google.maps.panoramio.PanoramioLayer();
//        panoramioLayer.setMap(map);
    }
 
    function registerComponent(){
        Core.registerComponent('MainMap', _interface);
    }
    
    var _interface = {
           getMap: function(){
               return map;
           }
       };
    init();
    return _interface;
}

